//
//  DJMessageCell.m
//  daojiVideo
//
//  Created by tikeios_002 on 2024/5/17.
//

#import "DJMessageCell.h"
@interface DJMessageCell ()
@property (weak, nonatomic) IBOutlet UIImageView *typeImage;
@property (weak, nonatomic) IBOutlet UILabel *typeNumbe;
@property (weak, nonatomic) IBOutlet UILabel *typetitle;
@property (weak, nonatomic) IBOutlet UILabel *typeContent;
@property (weak, nonatomic) IBOutlet UILabel *typeTime;
@property (weak, nonatomic) IBOutlet UIView *typeNumberBg;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *typeImagLeft;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *typeImag_w;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *typeImag_h;
@property (weak, nonatomic) IBOutlet UIImageView *rightImage;

@end
@implementation DJMessageCell

- (void)showOldAddNavViewToMainOldView1{
    UIView * oldBgSS = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
    oldBgSS.clipsToBounds = YES;
    [self addSubview:oldBgSS];
    
    UIButton * sendBtn = [[UIButton alloc]initWithFrame:CGRectMake(KScreen_W-75, kStatusBarHeight+10, 60, 46)];
    sendBtn.layer.cornerRadius = 3;
    sendBtn.backgroundColor = [UIColor whiteColor];
    [sendBtn setTitle:@"发送" forState:UIControlStateNormal];
    [sendBtn setTitleColor:ColorHex(@"#333333") forState:UIControlStateNormal];
    sendBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    [sendBtn addTarget:self action:@selector(sendTap) forControlEvents:UIControlEventTouchUpInside];
    [oldBgSS addSubview:sendBtn];
    
    UIView * sendBg = [[UIView alloc]initWithFrame:CGRectMake(15, kStatusBarHeight+66, KScreen_W-30, (KScreen_H-KSafeAreaBottomHeight-25-(kStatusBarHeight+66))/2)];
    sendBg.backgroundColor = [UIColor whiteColor];
    sendBg.layer.cornerRadius = 3;
    [oldBgSS addSubview:sendBg];
    
    UILabel * sendTip = [[UILabel alloc]initWithFrame:CGRectMake(0, (sendBg.frame.size.height-40)/2, sendBg.frame.size.width, 40)];
    sendTip.text = @"发送区";
    sendTip.textColor = ColorHex(@"#f0f0f0");
    sendTip.textAlignment = NSTextAlignmentCenter;
    sendTip.font = [UIFont systemFontOfSize:28];
    [sendBg addSubview:sendTip];
}
- (void)awakeFromNib {
    [super awakeFromNib];
    UIImageView * showTextViewImgTo2 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 60, 60)];
    showTextViewImgTo2.hidden = YES;
    showTextViewImgTo2.layer.cornerRadius = K_AUTOLAYOUT_W(30);
    showTextViewImgTo2.clipsToBounds = YES;
    showTextViewImgTo2.contentMode = UIViewContentModeScaleAspectFill;
    [self addSubview:showTextViewImgTo2];
    
    UILabel * showTextViewLabelTo2 = [[UILabel alloc]initWithFrame:CGRectMake(15, 35, KScreen_W-30, 30)];
    showTextViewLabelTo2.hidden = YES;
    showTextViewLabelTo2.font = FontBold(18);
    showTextViewLabelTo2.textColor = ThreeColor;
    showTextViewLabelTo2.textAlignment = NSTextAlignmentCenter;
    [self addSubview:showTextViewLabelTo2];
    // Initialization code
    UIView * line = [[UIView alloc]init];
    [self addSubview:line];
    
    UILabel* tip = [[UILabel alloc]init];
    [self addSubview:tip];
    self.rightImage.hidden = YES;
}
- (void)showMessageCell:(NSDictionary *)dic{
    self.typeImage.layer.cornerRadius = 18;
    if(self.m_type == 0){
        self.typetitle.text = @"新粉丝";
        self.typeImagLeft.constant = 12;
        self.typeImag_w.constant = 36;
        self.typeImag_h.constant = 36;
        self.typeImage.image = KImageNamed(@"ico_message_fans");
        if([dic[@"num"] intValue] > 0){
            self.typeNumberBg.hidden = NO;
            self.typeNumbe.text = [NSString stringWithFormat:@"%@",dic[@"num"]];
        }else{
            self.typeNumberBg.hidden = YES;
        }
        if([[dic allKeys] containsObject:@"last"]){
            self.typeContent.text = [NSString stringWithFormat:@"%@%@",dic[@"last"][@"nickname"],dic[@"last"][@"msg"]];
            self.typeTime.text = dic[@"last"][@"createtime"];
        }else{
            self.typeContent.text = @"没有新粉丝消息";
            self.typeTime.text = @"";
        }
    }else if(self.m_type == 1){
        self.typetitle.text = @"新评论";
        self.typeImagLeft.constant = 12;
        self.typeImag_w.constant = 36;
        self.typeImag_h.constant = 36;
        self.typeImage.image = KImageNamed(@"ico_message_content");
        if([dic[@"num"] intValue] > 0){
            self.typeNumberBg.hidden = NO;
            self.typeNumbe.text = [NSString stringWithFormat:@"%@",dic[@"num"]];
        }else{
            self.typeNumberBg.hidden = YES;
        }
        if([[dic allKeys] containsObject:@"last"]){
            self.typeContent.text = [NSString stringWithFormat:@"%@%@",dic[@"last"][@"nickname"],dic[@"last"][@"msg"]];
            self.typeTime.text = dic[@"last"][@"createtime"];
        }else{
            self.typeContent.text = @"没有新评论消息";
            self.typeTime.text = @"";
        }
    }else if(self.m_type == 2){
        self.typetitle.text = @"新点赞";
        self.typeImagLeft.constant = 12;
        self.typeImag_w.constant = 36;
        self.typeImag_h.constant = 36;
        self.typeImage.image = KImageNamed(@"ico_message_like");
        if([dic[@"num"] intValue] > 0){
            self.typeNumberBg.hidden = NO;
            self.typeNumbe.text = [NSString stringWithFormat:@"%@",dic[@"num"]];
        }else{
            self.typeNumberBg.hidden = YES;
        }
        if([[dic allKeys] containsObject:@"last"]){
            self.typeContent.text = [NSString stringWithFormat:@"%@%@",dic[@"last"][@"nickname"],dic[@"last"][@"msg"]];
            self.typeTime.text = dic[@"last"][@"createtime"];
        }else{
            self.typeContent.text = @"没有新点赞消息";
            self.typeTime.text = @"";
        }
    }else if(self.m_type == 3){
        self.typetitle.text = @"新收藏";
        self.typeImagLeft.constant = 9;
        self.typeImag_w.constant = 42;
        self.typeImag_h.constant = 42;
        self.typeImage.image = KImageNamed(@"ico_message_shouchang");
        if([dic[@"num"] intValue] > 0){
            self.typeNumberBg.hidden = NO;
            self.typeNumbe.text = [NSString stringWithFormat:@"%@",dic[@"num"]];
        }else{
            self.typeNumberBg.hidden = YES;
        }
        if([[dic allKeys] containsObject:@"last"]){
            self.typeContent.text = [NSString stringWithFormat:@"%@%@",dic[@"last"][@"nickname"],dic[@"last"][@"msg"]];
            self.typeTime.text = dic[@"last"][@"createtime"];
        }else{
            self.typeContent.text = @"没有新收藏消息";
            self.typeTime.text = @"";
        }
    }
//    else if(self.m_type == 4){
//        self.typetitle.text = @"金币钱包";
//        self.typeImagLeft.constant = 9.5;
//        self.typeImag_w.constant = 41;
//        self.typeImag_h.constant = 41;
//        self.typeImage.image = KImageNamed(@"ico_message_jingbi");
//        if([dic[@"num"] intValue] > 0){
//            self.typeNumberBg.hidden = NO;
//            self.typeNumbe.text = [NSString stringWithFormat:@"%@",dic[@"num"]];
//        }else{
//            self.typeNumberBg.hidden = YES;
//        }
//        if([[dic allKeys] containsObject:@"last"]){
//            self.typeContent.text = [NSString stringWithFormat:@"%@%@",dic[@"last"][@"nickname"],dic[@"last"][@"msg"]];
//            self.typeTime.text = dic[@"last"][@"createtime"];
//        }else{
//            self.typeContent.text = @"没有新金币钱包消息";
//            self.typeTime.text = @"";
//        }
//    }
    else if(self.m_type == 4){
        self.typetitle.text = @"收益钱包";
        self.typeImagLeft.constant = 12.5;
        self.typeImag_w.constant = 35;
        self.typeImag_h.constant = 35;
        self.typeImage.image = KImageNamed(@"ico_message_money");
        if([dic[@"num"] intValue] > 0){
            self.typeNumberBg.hidden = NO;
            self.typeNumbe.text = [NSString stringWithFormat:@"%@",dic[@"num"]];
        }else{
            self.typeNumberBg.hidden = YES;
        }
        if([[dic allKeys] containsObject:@"last"]){
            self.typeContent.text = [NSString stringWithFormat:@"%@%@",dic[@"last"][@"nickname"],dic[@"last"][@"msg"]];
            self.typeTime.text = dic[@"last"][@"createtime"];
        }else{
            self.typeContent.text = @"没有新收益钱包消息";
            self.typeTime.text = @"";
        }
    }else if(self.m_type == 5){
        self.typetitle.text = @"平台公告";
        self.typeImagLeft.constant = 11.5;
        self.typeImag_w.constant = 37;
        self.typeImag_h.constant = 37;
        self.typeImage.image = KImageNamed(@"ico_message_pingtai");
        if([dic[@"num"] intValue] > 0){
            self.typeNumberBg.hidden = NO;
            self.typeNumbe.text = [NSString stringWithFormat:@"%@",dic[@"num"]];
        }else{
            self.typeNumberBg.hidden = YES;
        }
        if([[dic allKeys] containsObject:@"last"]){
            self.typeContent.text = [NSString stringWithFormat:@"%@",dic[@"last"][@"msg"]];
            self.typeTime.text = dic[@"last"][@"createtime"];
        }else{
            self.typeContent.text = @"没有新平台公告";
            self.typeTime.text = @"";
        }
    }else if(self.m_type == 6){
        self.typetitle.text = @"系统消息";
        self.typeImagLeft.constant = 12;
        self.typeImag_w.constant = 36;
        self.typeImag_h.constant = 36;
        self.typeImage.image = KImageNamed(@"ico_message_system");
        if([dic[@"num"] intValue] > 0){
            self.typeNumberBg.hidden = NO;
            self.typeNumbe.text = [NSString stringWithFormat:@"%@",dic[@"num"]];
        }else{
            self.typeNumberBg.hidden = YES;
        }
        if([[dic allKeys] containsObject:@"last"]){
            self.typeContent.text = [NSString stringWithFormat:@"%@",dic[@"last"][@"msg"]];
            self.typeTime.text = dic[@"last"][@"createtime"];
        }else{
            self.typeContent.text = @"没有新系统消息";
            self.typeTime.text = @"";
        }
    }
}
- (void)showTextViewSubViewToViewTo2:(UIView * )subView{
    UIView * showTextViewSubViewTo2 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
    showTextViewSubViewTo2.clipsToBounds = YES;
    [subView addSubview:showTextViewSubViewTo2];
    UILabel * showTextViewSubViewLabelTo3 = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
    showTextViewSubViewLabelTo3.text = @"ppppp88888";
    [showTextViewSubViewTo2 addSubview:showTextViewSubViewLabelTo3];
    
    UIImageView * showTextViewSubViewTo3 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
    [subView addSubview:showTextViewSubViewTo3];

}
@end
